<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    input{
        margin-right:20px ;
    }
</style>
<script src="jQuery.min.js"></script>
<script>
    $(function(){
    $("#all").change(function(){
    $("#tbody input").prop("checked",$(this).prop("checked"));
    });
    $('#tbody input').change(function(){
    if($("#tbody input:checked").length == $("#tbody input").length){
     $("#all").prop('checked',true);                                                  
    }else{
     $("#all").prop('checked',false);      
    }
    })
    })
</script>
<body>
    <table border="1" width="600px" height="80px" align="center" cellpadding="20" cellspacing="20" style="border-collapse:collapse;margin-top:100px;">
        <tr><td><input type="checkbox" name="" id="all">全选</td></tr>
        <tbody id="tbody">
        <tr><td><input type="checkbox" name="">文件1</td></tr>
        <tr><td><input type="checkbox" name="">文件2</td></tr>
        <tr><td><input type="checkbox" name="">文件3</td></tr>
        <tr><td><input type="checkbox" name="">文件4</td></tr>
        <tr><td><input type="checkbox" name="">文件5</td></tr>
       </tbody>
    </table>
</body>
</html>